package tc.de.krawallmann.gravoblocks.util.pathfinding;

/**
 * The Class Node. Adapted from
 * http://www.java-forum.org/codeschnipsel-u-projekte/5046-codeschnipsel.html
 */
public class Node {
	private transient float fValue;
	private transient float gValue;
	private transient float hValue;
	private transient final Node parent;
	private transient final int xPosition, yPosition;

	public Node(final Node parent, final float gValue, final float hValue, final int xPosition,
			final int yPosition) {
		this.parent = parent;
		this.xPosition = xPosition;
		this.yPosition = yPosition;
		this.gValue = gValue;
		this.hValue = hValue;
		fValue = gValue + hValue;
	}

	public Node(final Node parent, final int xPosition, final int yPosition) {
		this.parent = parent;
		this.xPosition = xPosition;
		this.yPosition = yPosition;
	}

	public float getFValue() {
		return fValue;
	}

	public float getGValue() {
		return gValue;
	}

	public float getHValue() {
		return hValue;
	}

	/**
	 * @return den davorfolgenden Knoten bzw null, wenn es keinen mehr gibt
	 */
	public Node getParent() {
		return parent;
	}

	public int getxPosition() {
		return xPosition;
	}

	public int getXPosition() {
		return xPosition;
	}

	public int getyPosition() {
		return yPosition;
	}

	public int getYPosition() {
		return yPosition;
	}

	public void setFValue(final float fValue) {
		this.fValue = fValue;
	}

	public void setGValue(final float gValue) {
		this.gValue = gValue;
	}

	public void setHValue(final float hValue) {
		this.hValue = hValue;
	}

}
